using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;

namespace MoocProject
{
    internal static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // To customize application configuration such as set high DPI settings or default font,
            // see https://aka.ms/applicationconfiguration.
            ApplicationConfiguration.Initialize();
            ConfigurationBuilder configBuilder = new ConfigurationBuilder();
            configBuilder.AddJsonFile("appsettings.json",optional:false,reloadOnChange:true);
            IConfigurationRoot config = configBuilder.Build();
			ServiceCollection service = new ServiceCollection();
			service.AddScoped<ICrawFactory, CrawFactory>();
            service.AddScoped<ICrawService, CrawService>();
            service.AddOptions().Configure<CrawConfig>(e=>config.GetSection("Craw").Bind(e));
			service.AddScoped<Form1>();
			using var provider = service.BuildServiceProvider();
			var MainForm = provider.GetRequiredService<Form1>();
            Application.Run(MainForm);
        }
    }
}